package com.example.demo.service.imp;

import com.example.demo.mapper.UserGradeMapper;
import com.example.demo.pojo.UserGrade;
import com.example.demo.service.UserGradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class UserGradeServiceImp implements UserGradeService {

    @Autowired
    private UserGradeMapper userGradeMapper;

    @Override
    public List<UserGrade> getAll(Integer user_id) {
        return userGradeMapper.getGradeById(user_id);
    }

    @Override
    @Transactional
    public void add(UserGrade userGrade) {
        userGradeMapper.add(userGrade);
    }

    @Override
    @Transactional
    public void delete(Integer id) {
        userGradeMapper.deleteById(id);
    }
}
